<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<a href="../wen1.png" onclick="alert(1);">111</a>
</body>
</html>
<script>

    function savepic() {
        alert(1);
        console.log(1);
        if (document.all.a1 == null) {
            objIframe = document.createElement("IFRAME");
            document.body.insertBefore(objIframe);
            objIframe.outerHTML = "<iframe name=a1 style='width:400px;hieght:300px' src=" + imageName.href + "></iframe>";
            re = setTimeout("savepic()", 1)
        }
        else {
            clearTimeout(re)
            pic = window.open(imageName.href, "a1")
            pic.document.execCommand("SaveAs")
            document.all.a1.removeNode(true)
        }
    }
</script>